/**
 * 寻找深层次对象属性值
 * @param {Object} data 
 * @param {String} keyName 
 * @description {
 * var data =  a: {
 *      b: {
 *          c: 100
 *      }
 *  }
 * }
 * lookup(data,'a.b.c')
 */
export function lookup(data, keyName) {

    if (keyName != "." && keyName.indexOf(".") != -1) {
        var temp = data;
        var keyArray = keyName.split(".");

        for (let i = 0; i < keyArray.length; i++) {
            const key = keyArray[i];
            temp = temp[key];
        }
        return temp;
    }

    return data[keyName];

}